const app = getApp()
Page({
  data: {
    hidden:false,
    type:'',
    appPoint:[
      {
        key: 'user',
        val: "用户",
      },
      {
        key: 'card',
        val: "名片",
      },
      ]
  },
  onLoad: function (options) {
  
  },
  goBackHome: function () {
    wx.navigateBack();
  },
  getSarchCode:function(e){
    var that = this;
    var key = e.detail.value
    var type = that.data.type
    if (!key || key == '')
    return app.prompt('搜索内容不能为空')
    if (type == '' || !type) 
    return app.prompt('请选择搜索内容');
    wx.navigateTo({
      url: '../sarchList/index?key=' + key + '&type=' + type,
    })

  },
  choiceSarchPoint:function(e){
    console.log(e)
    this.setData({
      hidden:true,
      type: e.currentTarget.id,
    })
  },
  cancelSarchPoint: function () {
    this.setData({
      hidden: false,
      type: '',
    })
  },
  //网络请求
  netWorkRequest: function (data = '', url = '', name, post = "POST") {
    var that = this
    wx.request({
      url: url, //仅为示例，并非真实的接口地址
      post: post,
      data: data,
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        console.log(res)
        if (res.data.code == 0) {
          var calkdata = res.data.data
          if (name == 'circle') {
            that.setData({
              circle: calkdata
            })
          }
        }
      },
      fail: function (res) {
        app.prompt()
        return
      }
    })
    return true
  },
})